import request from '@/utils/request.js'
const PATH = '/admin/testCategory'

// 分页查询测试分类
export const getTestCategoryList = ({ page, pageSize, testName, status }) => {
  return request.get(PATH + '/page', {
    params: {
      page,
      pageSize,
      testName,
      status
    }
  })
}

// 新增测试分类
export const insertTestCategory = (data) => {
  return request.post(PATH + '/insert', data)
}

// 修改测试分类状态
export const updateTestCategoryStatus = ({ id, status }) => {
  return request.post(PATH + `/status/${status}`, {
    id
  })
}

// 批量修改测试分类
export const batchDeleteTestCategory = (ids) => {
  return request.delete(PATH + '/batchDelete', {
    params: {
      ids: ids.join(',')
    }
  })
}

// 根据id查询测试分类
export const getTestCategoryById = (id) => {
  return request.get(PATH + '/getTestCategoryById', {
    params: {
      id
    }
  })
}

// 修改测试分类
export const updateTestCategory = (data) => {
  return request.put(PATH + '/update', data)
}

// 查询所有启动的测试分类
export const getAllTestCategory = () => {
  return request.get(PATH + '/getAll')
}
